<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>sysmonpsu: xsysmonpsu_intr_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">sysmonpsu
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xsysmonpsu__intr__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xsysmonpsu_intr_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the driver functions of the System Monitor driver. </p>
<p>This example here shows the usage of the driver/device in interrupt mode to handle on-chip temperature and voltage alarm interrupts.</p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This code assumes that no Operating System is being used.</p>
<p>The values of the on-chip Temperature, Supply 1 voltage and Supply 3 voltage are read from the device and then the alarm thresholds are set in such a manner that the alarms occur.</p>
<p>This examples also assumes that there is a STDIO device in the system. This example has floating point calculations and uses printfs for outputting floating point data, therefore the memory allocated for the Stack must be more.</p>
<pre></pre><pre>MODIFICATION HISTORY:</pre><pre>Ver   Who    Date     Changes
</p>
<hr/>
<p>
1.0   kvn    12/15/15 First release
             02/15/16 Corrected order of Enabling / Disabling of
                      interrupts.
      ms     04/05/17 Modified Comment lines in functions to
                      recognize it as documentation block for doxygen
                      generation.
2.3  ms      12/12/17 Added peripheral test support
     mn      03/08/18 Update code to run at higher frequency
2.6  aad     11/21/19 Removed reading of AUX channels
     aad     11/22/19 Added support for PL_EXAMPLE
2.9   cog    07/20/23 Added support for SDT flow</pre><pre></pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a26b92e20e1b2b69c588591b91d185d12"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsysmonpsu__intr__example_8c.html#a26b92e20e1b2b69c588591b91d185d12">SysMonPsuIntrExample</a> (XScuGic *XScuGicInstPtr, <a class="el" href="struct_x_sys_mon_psu.html">XSysMonPsu</a> *SysMonInstPtr, u32 SysMonDeviceId, u16 SysMonIntrId)</td></tr>
<tr class="memdesc:a26b92e20e1b2b69c588591b91d185d12"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function runs a test on the System Monitor device using the driver APIs.  <a href="#a26b92e20e1b2b69c588591b91d185d12">More...</a><br/></td></tr>
<tr class="separator:a26b92e20e1b2b69c588591b91d185d12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsysmonpsu__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function that invokes the Interrupt example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function that invokes the Interrupt example. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if the example has completed successfully.</li>
<li>XST_FAILURE if the example has failed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xsysmonpsu__intr__example_8c.html#a26b92e20e1b2b69c588591b91d185d12">SysMonPsuIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a26b92e20e1b2b69c588591b91d185d12"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SysMonPsuIntrExample </td>
          <td>(</td>
          <td class="paramtype">XScuGic *&#160;</td>
          <td class="paramname"><em>XScuGicInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_x_sys_mon_psu.html">XSysMonPsu</a> *&#160;</td>
          <td class="paramname"><em>SysMonInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>SysMonDeviceId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>SysMonIntrId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function runs a test on the System Monitor device using the driver APIs. </p>
<p>The function does the following tasks:</p>
<ul>
<li>Initiate the System Monitor device driver instance</li>
<li>Run self-test on the device</li>
<li>Reset the device</li>
<li>Set up alarms for on-chip temperature, Supply 1 and Supply 3</li>
<li>Set up sequence registers to continuously monitor on-chip temperature, Supply 1 and Supply 3</li>
<li>Setup interrupt system</li>
<li>Enable interrupts</li>
<li>Set up configuration registers to start the sequence</li>
<li>Wait until temperature alarm interrupt or Supply 1 alarm interrupt or Supply 3 alarm interrupt occurs</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">XScuGicInstPtr</td><td>is a pointer to the Interrupt Controller driver Instance. </td></tr>
    <tr><td class="paramname">SysMonInstPtr</td><td>is a pointer to the <a class="el" href="struct_x_sys_mon_psu.html" title="The XSysmonPsu driver instance data. ">XSysMonPsu</a> driver Instance. </td></tr>
    <tr><td class="paramname">SysMonDeviceId</td><td>is the XPAR_&lt;SYSMON_instance&gt;_DEVICE_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">SysMonIntrId</td><td>is XPAR_&lt;SYSMON_instance&gt;_INTR value from xparameters_ps.h</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if the example has completed successfully.</li>
<li>XST_FAILURE if the example has failed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function may never return if no interrupt occurs. </dd></dl>

<p>References <a class="el" href="struct_x_sys_mon_psu___config.html#a0166b8968529950a2b997038b7d99f16">XSysMonPsu_Config::BaseAddress</a>, <a class="el" href="xsysmonpsu_8h.html#a6dfa93eff75396bbfad602d8586995d7">XSM_ATR_SUP1_LOWER</a>, <a class="el" href="xsysmonpsu_8h.html#a220ecdeca017ceb88fcb61fcc0f20253">XSM_ATR_SUP1_UPPER</a>, <a class="el" href="xsysmonpsu_8h.html#a5b01f56ee33bf0ed6e0d42cac33cb50f">XSM_ATR_SUP3_LOWER</a>, <a class="el" href="xsysmonpsu_8h.html#a58fa91d71bb7459ec43600876c0ad4be">XSM_ATR_SUP3_UPPER</a>, <a class="el" href="xsysmonpsu_8h.html#a138ea63ae47cd1478f188045792a5aef">XSM_ATR_TEMP_LOWER</a>, <a class="el" href="xsysmonpsu_8h.html#a7e041ad6a624c7014aad8803d2f9667a">XSM_ATR_TEMP_UPPER</a>, <a class="el" href="xsysmonpsu_8h.html#a7cd77d90e7456614726390476f3636c8">XSM_AVG_16_SAMPLES</a>, <a class="el" href="xsysmonpsu_8h.html#adf617c1e2104003abbd7cec9a69411f7">XSM_CFR_ALM_SUPPLY1_MASK</a>, <a class="el" href="xsysmonpsu_8h.html#a5468b12d45def4d7b462ac5a735c1605">XSM_CFR_ALM_SUPPLY3_MASK</a>, <a class="el" href="xsysmonpsu_8h.html#a69ff380ea74c831bcf39a5c46652d056">XSM_CFR_ALM_TEMP_MASK</a>, <a class="el" href="xsysmonpsu_8h.html#a0b564ae32085a3fc51c452d1babe46db">XSM_CH_SUPPLY1</a>, <a class="el" href="xsysmonpsu_8h.html#a7c4df26dc69ef41921c484fd3ccc006c">XSM_CH_SUPPLY3</a>, <a class="el" href="xsysmonpsu_8h.html#af2f79c54dddbdf090934f80f315b2e60">XSM_CH_TEMP</a>, <a class="el" href="xsysmonpsu_8h.html#a2ab1b4304d1e781bd7a9908718620c0b">XSM_MAX_SUPPLY1</a>, <a class="el" href="xsysmonpsu_8h.html#a4cc0e390c18e733d61a5bec32f8f806f">XSM_MAX_SUPPLY3</a>, <a class="el" href="xsysmonpsu_8h.html#a35d9814abedb2943f4a84ecff66351e5">XSM_MAX_TEMP</a>, <a class="el" href="xsysmonpsu_8h.html#acda48741be11b7a96ece33a3f67dbd74">XSM_MIN_SUPPLY1</a>, <a class="el" href="xsysmonpsu_8h.html#a4ae90b5125c90a5ecf98415c05e493a2">XSM_MIN_SUPPLY3</a>, <a class="el" href="xsysmonpsu_8h.html#af3acf3098ee563aa1cc3e35555d4e801">XSM_MIN_TEMP</a>, <a class="el" href="xsysmonpsu_8h.html#a090e870886f3ed8d58efc57c763772f2">XSM_SEQ_MODE_CONTINPASS</a>, <a class="el" href="xsysmonpsu_8h.html#a223c74befcd8a6710ea7a7acbaf41636">XSM_SEQ_MODE_SAFE</a>, <a class="el" href="xsysmonpsu_8c.html#a8cd0584410c0931f931aa4da1e3e151b">XSysMonPsu_CfgInitialize()</a>, <a class="el" href="xsysmonpsu_8c.html#a54eb6ba4c6f594b75d402cde03f6e173">XSysMonPsu_GetAdcData()</a>, <a class="el" href="xsysmonpsu_8c.html#a708bc2465a24743784ce6119bc05b10a">XSysMonPsu_GetAlarmThreshold()</a>, <a class="el" href="xsysmonpsu_8c.html#aa4312c89ab0280cd7df2de940193fe32">XSysMonPsu_GetMinMaxMeasurement()</a>, <a class="el" href="xsysmonpsu_8h.html#a7c41996bf95cd7119dba302246345a9d">XSysMonPsu_IntrClear()</a>, <a class="el" href="xsysmonpsu_8h.html#a97be122426bd5302e93b45ba5a3fc8ec">XSysMonPsu_IntrEnable()</a>, <a class="el" href="xsysmonpsu_8h.html#a3ef44a74426b13480363747a5dedc5d0">XSysMonPsu_IntrGetStatus()</a>, <a class="el" href="xsysmonpsu_8h.html#a948f08280b6195869015382d92ba8a50">XSysMonPsu_LookupConfig()</a>, <a class="el" href="xsysmonpsu_8h.html#a380d87507652a19d453b20e6d7655d65">XSysMonPsu_RawToTemperature_OnChip</a>, <a class="el" href="xsysmonpsu_8h.html#af6667f0fcc65dda4a7af897b2924143c">XSysMonPsu_RawToVoltage</a>, <a class="el" href="xsysmonpsu_8h.html#a39d8d59cc35fe4151b51b5bbafdca2ca">XSysMonPsu_SelfTest()</a>, <a class="el" href="xsysmonpsu_8c.html#a3ce8ca01b6992994737213f342847662">XSysMonPsu_SetAlarmEnables()</a>, <a class="el" href="xsysmonpsu_8c.html#a6d436ab807a561d70339cdfe52f6f560">XSysMonPsu_SetAlarmThreshold()</a>, <a class="el" href="xsysmonpsu_8c.html#a711d9441ecb7c36f22b11f941d7f994b">XSysMonPsu_SetAvg()</a>, <a class="el" href="xsysmonpsu_8c.html#adb114566387fa8889b913f34a7de6010">XSysMonPsu_SetSeqAvgEnables()</a>, <a class="el" href="xsysmonpsu_8c.html#ac51295c525a507a8f334c97f02a84221">XSysMonPsu_SetSeqChEnables()</a>, <a class="el" href="xsysmonpsu_8c.html#aa4bdb4e555b2c8d47a0185862c9cb4c6">XSysMonPsu_SetSequencerMode()</a>, <a class="el" href="xsysmonpsu_8h.html#a977b419288fae23364d46bc87d6976ce">XSysMonPsu_TemperatureToRaw_OnChip</a>, and <a class="el" href="xsysmonpsu_8h.html#a986f164c3c1f811ea27713adf9dace4c">XSysMonPsu_VoltageToRaw</a>.</p>

<p>Referenced by <a class="el" href="xsysmonpsu__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
